package cc.plumgo.ss.ui.page;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import cc.plumgo.j2me.utils.CustomPage;
import cc.plumgo.ss.core.Console;
import cc.plumgo.ss.core.Constants;

public class PausePage extends CustomPage {
	private Image backImage;
	
	public static final int PAUSE_HIDE = 0;
	public static final int PAUSE_SHOW = 1;
	public static final int PAUSE_STATE_NUM = 2;
	
	public static final int S_GOON = 0;
	public static final int S_OPTION = 1;
	public static final int S_EXIT = 2;
	
	public PausePage() {
		super();
		selected = 0;
	}
	public void process(int keyStates, Graphics g) {
		switch (state) {
		case PAUSE_HIDE : {
			break;
		}
		case PAUSE_SHOW : {
			loadSprite(Constants.UI_IMG_MENU_BTN, Constants.UI_MENU_BTN[0], Constants.UI_MENU_BTN[1]);
			loadBackImage();
			g.drawImage(Console.getInstance().getScreen(), 0, 0, 0);
			g.drawImage(backImage, 36, 75, 0);
			drawButton(g);
			break;
		}
		}
	}
	
	private void drawButton(Graphics g) {
		sprite.setPosition(45, 85);
		sprite.paint(g);
		sprite.setPosition(45, 120);
		sprite.paint(g);
		sprite.setPosition(45, 155);
		sprite.paint(g);
		
	}

	public void loadBackImage() {
		if (backImage == null) {
			try {
				backImage = Image.createImage(Constants.UI_IMG_MENU_BACK);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
